<?

$check_me_authed = "NO_OK";

if(($jid = $_POST["radioview"]) || ($jid = $_POST["job_id_posted"]) ){

	$Db = new oracleDb;
  $Db->init($_SESSION["ORCL"],
             $_SESSION["OPASS"],
             $_SESSION["SID"],
             _NO_COMMENT);

	if ($Db->connect()) {

  	$srcDbHdr = "MST_MODEL";
    $srcDbDtl = "MST_CONVERTION";

		$_SESSION["jid"]  = $_POST["radioview"];
		$jobId            = &$_SESSION["jid"];

		/**
		* Fetch global header
		* And check the status if it is valid
		* where STATUS = _NOT_ACTIVE
		*
		*/
		$CLFetchers->fetchLstDataHeader($Db,
                                    $jobId,
                                    $SourceDb,
                                    $nHeader,
                                    $lstHeader);

    $_POST["modelEnt"] = $lstHeader["MODEL"][0];

		/**
		* Init the detail
		*
		*/
		$CLFetchers->fetchLstDataDetail($Db,
                                    $jobId,
                                    $srcDbDtl,
                                    $nDetail,
                                    $lstDetail);

		for($iRow = 0; $iRow < $nDetail; $iRow++){

      $_POST["fromEnt"][$iRow] = $lstDetail["UNIT_NAME"][$iRow];
      $_POST["toEnt"][$iRow]   = $lstDetail["UNIT_TO"][$iRow];
      $_POST["qtyEnt"][$iRow]  = $lstDetail["QTY"][$iRow];
		}

  	$_SESSION["modify_mode"]= "Y";

		/**
		* This is only to by pass
		* the entry_detail precheck
		*
		*/
		//$_POST["entry"]         = "byPass";
		$_SESSION["init_num"]   = $nDetail;

		$Db->dc();

		require("entry_restore_me.php");

	}else{

	  $Misc->usrDieJs(_DB_CONN_ERROR);
	}
}else{

	$Misc->usrDieJs("Error:Cant retrieved job_id");
}

?>